<!DOCTYPE HTML>
<html>
<head>
    <title>Error</title>
    <link rel="stylesheet" href="/stylesheets/style.css">
    <script src="/scripts/jquery.min.js"></script>
    <link rel="stylesheet" href="/scripts/miniui/themes/default/miniui.css">
    <link rel="stylesheet" href="/scripts/miniui/themes/icons.css">
    <link rel="stylesheet" href="/scripts/miniui/themes/bootstrap/skin.css">
    <script src="/scripts/miniui/miniui.js"></script>
</head>
<body>
<span style="width:80px;display:inline-block;">收货人：</span>
<input id="name" class="mini-textbox" style="width:155px;" value="<%= result.data[0].name %>"/>

<span style="width:80px;display:inline-block;margin-left: 30px">电话号码：</span>
<input id="tel" class="mini-textbox" style="width:170px;" value="<%= result.data[0].tel%>" />
<br/><br/>

<span style="width:80px;display:inline-block;">是否默认：</span>
<input id="isDefault" class="mini-combobox" style="width:155px;" data="userStatus"  value="<%= result.data[0].isDefault %>"/>

<span style="width:80px;display:inline-block;margin-left: 30px">省：</span>
<input id="province" class="mini-textbox" style="width:170px;" value="<%= result.data[0].province %>"/>

<br/><br/>

<span style="width:80px;display:inline-block;">城市：</span>
<input id="city" class="mini-textbox" style="width:155px;" data="userStatus" value="<%= result.data[0].city %>" />

<br/><br/>

<span style="width:80px;display:inline-block;">详细地址：</span>
<textarea id="address" class="mini-textarea"  style="width: 190px" value="<%= result.data[0].address %>"></textarea>

<br/><br/>
<div style="margin: 0 auto;text-align: center">
    <a class="mini-button " iconCls="icon-ok" onclick="updataUserStatus()">确定</a>
    <a class="mini-button" iconCls="icon-cancel" onclick="onCancel">取消</a>
</div>
</body>
<script>
    var userStatus = [{ id: 1, text: '是' }, { id: 0, text: '否'}];
    var objectId = '<%= result.data[0].objectId%>'
    var userOId = '<%= result.data[0].userOId%>'
    function updataUserStatus() {
        var name = mini.get("name").getValue();
        var tel = mini.get("tel").getValue();
        var address = mini.get("address").getValue();
        var isDefault = mini.get("isDefault").getValue();
        var city = mini.get("city").getValue();
        var province = mini.get("province").getValue();

        $.ajax({
            type: "POST",
            url: "/getdata/updateUserAddress",
            data: {
                userOId:userOId,
                objectId:objectId,
                address: address,
                name: name,
                tel: tel,
                isDefault: isDefault,
                city: city,
                province: province,
            },
            success: function (result) {
                CloseWindow("save");
            }
        })
    }
    //    关闭窗口
    function CloseWindow(action) {
        if (action == "close" && form.isChanged()) {
            if (confirm("数据被修改了，是否先保存？")) {
                return false;
            }
        }
        if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
        else window.close();
    }
    function onOk(e) {
        SaveData();
    }
    function onCancel(e) {
        CloseWindow("cancel");
    }
</script>
</html>